Due on Thursday, May 26 (the last day of classes)
You may work with a partner on this assignment.
For this lab you will write a program that allows you to play the "Kevin Bacon Game". A person's "Bacon Number" is computed based on the number of movies of separation between that person and the actor Kevin Bacon. For example, if you are Kevin Bacon, then your Bacon Number is 0. If you were in a movie with Kevin Bacon, your number would be 1. If you weren't in a movie with Kevin Bacon, but were in a movie with someone who was, your Bacon Number would be 2. In short, your Bacon Number is one greater than the smallest Bacon Number of any of your co-stars. We will make use of data tables from the Internet Movie Database to calculate Bacon Numbers.
For fun and some additional background, you can try out the Oracle of Bacon at the University of Virginia.
There is starter code for this lab. Make a new project folder Lab9<LastName>. Download and unzip Lab9Start.zip into the new project folder before you start up Eclipse. Then make a new Lab9 project and away you go.
To save you some time and to keep everyone on the same structure, I am giving you some files with starter code:
The movie data file contains information on what movies a performer appears in. Every line contains information on one person appearing in one movie. The lines are formatted as follows:
<performer name>|<movie title>
The vertical pipe character '|' can be used to determine where the name ends and the title begins. There will only be one '|' on a line and there are no empty names or titles. The Java String class has a number of methods that can be used to divide up the line. One easy way to do this is to scan a line of the file into String line, let int b be line.indexOf( '|') and to split the line into two substrings: one before b and one after b.
To help you debug your program I have given you one non-IMDB file called "Simple.txt". Here is the complete contents:
A|One A|Two A|Three B|Two C|Three C|Four D|Four D|Five E|Five F|Five
Here A, B, C, D, E, and F are actors and One, Two, Three, Four, and Five are movies. You want your program to build the following graph:
Note that for every line A|B in the file you will create two edges: one from node A to node B, and one from B back to A. Your findAllPaths( ) method using node A as the source will add to this the following edges, shown in red:
The distance variable you use in this method assigns as the distance for each node the number of red edges between it and the source: A has distance 0, B has distance 1, C has distance 2, and so forth. The actors all have even distance, the movues akk have odd distance. This allows you to add each Vertex to either the availableActors list or the availableMovies list when you assign its distance.
The zipped file of starter code has some smaller data files. Note that in each of the IMDB files Kevin Bacon is referred to as "Kevin Bacon (I)".
I have also posted with the lab
Please delete all of your ".txt" data files. Look through your ".java" files and make sure you've included your name (and your partner's name if you worked with a partner) at the top of all of them. You should have four class files: Vertex.java, Edge.java, Graph.java and MakeGraph.java.
Include in your submission a file named README. The contents of the README file should include the following:
As usual, make a zipped copy of you project folder (which should be Lab9<your last name>) and hand it in on Blackbard as Lab9.
Information courtesy of The Internet Movie Database (http://www.imdb.com/). Used with permission. The data should only be used for personal and non-commercial purposes.